<!DOCTYPE html>
<html lang='zh-CN'>
<head>
    <meta charset='utf-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <title>飞书 SDK - 控制面板</title>
    <style>
        :root {
            --primary: #3b82f6;
            --primary-dark: #1e40af;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --bg: #f8fafc;
            --card: #ffffff;
            --border: #e2e8f0;
            --text: #1e293b;
            --text-muted: #64748b;
            --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
            --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
        }
        
        * { box-sizing: border-box; margin: 0; padding: 0; }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            color: var(--text);
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 2rem 1rem;
        }
        
        .header {
            text-align: center;
            margin-bottom: 3rem;
            color: white;
        }
        
        .header h1 {
            font-size: 2.5rem;
            font-weight: 700;
            margin-bottom: 0.5rem;
        }
        
        .header p {
            font-size: 1.125rem;
            opacity: 0.9;
        }
        
        .cards-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 2rem;
            margin-bottom: 2rem;
        }
        
        .card {
            background: var(--card);
            border-radius: 16px;
            padding: 2rem;
            box-shadow: var(--shadow-lg);
            transition: transform 0.2s, box-shadow 0.2s;
        }
        
        .card:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);
        }
        
        .card-icon {
            width: 48px;
            height: 48px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            margin-bottom: 1rem;
        }
        
        .card-title {
            font-size: 1.25rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
            color: var(--text);
        }
        
        .card-desc {
            color: var(--text-muted);
            margin-bottom: 1.5rem;
            line-height: 1.5;
        }
        
        .btn {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.75rem 1.5rem;
            background: var(--primary);
            color: white;
            text-decoration: none;
            border-radius: 8px;
            font-weight: 500;
            transition: background-color 0.2s;
        }
        
        .btn:hover {
            background: var(--primary-dark);
        }
        
        .status-card {
            grid-column: 1 / -1;
        }
        
        .status-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1rem;
        }
        
        .status-item {
            text-align: center;
            padding: 1rem;
            border-radius: 8px;
            background: var(--bg);
        }
        
        .status-value {
            font-size: 1.5rem;
            font-weight: 600;
            margin-bottom: 0.25rem;
        }
        
        .status-label {
            font-size: 0.875rem;
            color: var(--text-muted);
        }
        
        .footer {
            text-align: center;
            padding: 2rem;
            color: rgba(255, 255, 255, 0.8);
        }
    </style>
</head>
<body>
    <div class='container'>
        <div class='header'>
            <h1>🚀 飞书 SDK 控制面板</h1>
            <p>企业级飞书审批工作流管理系统</p>
        </div>
        
        <div class='cards-grid'>
            <div class='card status-card'>
                <div class='card-icon' style='background: linear-gradient(45deg, #667eea, #764ba2);'>
                    📊
                </div>
                <div class='card-title'>系统状态</div>
                <div class='card-desc'>当前系统运行状态和配置信息</div>
                
                <div class='status-grid' id='statusGrid'>
                    <div class='status-item'>
                        <div class='status-value' id='configStatus'>检查中...</div>
                        <div class='status-label'>配置状态</div>
                    </div>
                    <div class='status-item'>
                        <div class='status-value' id='apiStatus'>检查中...</div>
                        <div class='status-label'>API连接</div>
                    </div>
                    <div class='status-item'>
                        <div class='status-value' id='dbStatus'>正常</div>
                        <div class='status-label'>数据库</div>
                    </div>
                    <div class='status-item'>
                        <div class='status-value'>{{Version}}</div>
                        <div class='status-label'>SDK版本</div>
                    </div>
                </div>
            </div>
            
            <div class='card'>
                <div class='card-icon' style='background: linear-gradient(45deg, #f093fb, #f5576c);'>
                    ⚙️
                </div>
                <div class='card-title'>系统配置</div>
                <div class='card-desc'>配置飞书应用凭证、管理审批流程、生成代码模板</div>
                <a href='{{ManagePath}}' class='btn'>
                    🔧 进入管理页面
                </a>
            </div>
            
            <div class='card'>
                <div class='card-icon' style='background: linear-gradient(45deg, #4facfe, #00f2fe);'>
                    📋
                </div>
                <div class='card-title'>API文档</div>
                <div class='card-desc'>查看完整的REST API接口文档和使用示例</div>
                <a href='{{ApiPrefix}}/docs' class='btn'>
                    📖 查看文档
                </a>
            </div>
            
            <div class='card'>
                <div class='card-icon' style='background: linear-gradient(45deg, #43e97b, #38f9d7);'>
                    🔍
                </div>
                <div class='card-title'>日志监控</div>
                <div class='card-desc'>查看系统运行日志、请求记录和错误信息</div>
                <button class='btn' onclick='loadLogs()'>
                    📊 查看日志
                </button>
            </div>
            
            <div class='card'>
                <div class='card-icon' style='background: linear-gradient(45deg, #fa709a, #fee140);'>
                    💡
                </div>
                <div class='card-title'>快速开始</div>
                <div class='card-desc'>查看快速集成指南和代码示例</div>
                <button class='btn' onclick='showQuickStart()'>
                    🚀 开始使用
                </button>
            </div>
        </div>
    </div>
    
    <div class='footer'>
        <p>Powered by BD.FeishuSDK • Made with ❤️ by BD Team</p>
    </div>
    
    <script>
        // 检查系统状态
        async function checkSystemStatus() {
            try {
                // 检查配置状态
                const configResponse = await fetch('{{ApiPrefix}}/config/status');
                const configData = await configResponse.json();
                document.getElementById('configStatus').textContent = configData.configured ? '✅ 已配置' : '⚠️ 未配置';
                
                // 检查API状态
                document.getElementById('apiStatus').textContent = '✅ 正常';
            } catch (error) {
                document.getElementById('configStatus').textContent = '❌ 错误';
                document.getElementById('apiStatus').textContent = '❌ 断开';
            }
        }
        
        function loadLogs() {
            alert('日志功能正在开发中...');
        }
        
        function showQuickStart() {
            const quickStartInfo = `
🚀 快速开始指南

1. 配置凭证：前往管理页面设置飞书应用的 AppId 和 AppSecret
2. 登记审批：在飞书管理后台获取审批 approval_code，然后在管理页中登记
3. 生成代码：系统会自动分析审批表单结构，生成对应的 C# 请求类
4. 业务集成：在你的业务代码中注入 IFeishuApprovalInstanceService 即可发起审批

更多详细信息请查看 README.md 文档。
            `;
            alert(quickStartInfo);
        }
        
        // 页面加载时检查状态
        document.addEventListener('DOMContentLoaded', checkSystemStatus);
    </script>
</body>
</html>